package cn.edu.jssvc.skills.skillscompetitionitestbank;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class GuideActivity extends AppCompatActivity {
    private Handler handler;
    private Runnable runnable;
    private SharedPreferences preferences;
    private SharedPreferences.Editor editor;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);
        preferences=PreferenceManager.getDefaultSharedPreferences(this);
        Boolean isFirst=preferences.getBoolean("isFirst",true);

        if(isFirst) {
            Log.d("引导","第二次启动");
            Intent intent=new Intent(GuideActivity.this,FirstActivity.class);
            startActivity(intent);
        }else {
            handler=new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    Log.d("引导","第一次启动");
                    editor=preferences.edit();
                    editor.putBoolean("isfirst",true);
                    editor.apply();

                    Intent intent=new Intent(GuideActivity.this,FirstActivity.class);
                    startActivity(intent);
                    finish();
                }
            },3000);

        }
    }
}
